<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2017/9/11
 * Time: 10:55
 */
use yii\widgets\Pjax;
use yii\widgets\ListView;
use yii\data\ActiveDataProvider;
use frontend\models\Category;
use frontend\models\Goods;
use kop\y2sp\ScrollPager;
?>
<link rel="stylesheet"  href="./mycss/weixinlunbo.css">
 
<div class="homescreenadd"><i class="homescreendw"></i><span  id="showareainfo">定位地址信息...</span><i class="fa fa-angle-right"></i></div>
<div class="homscrsear">
<input style="    background-position: 3% center;" readonly type="text" placeholder="请输入店铺名、商品名">
</div>

<div id="wrapper" style="top:73px;">

	<div id="scroller">

		<!--展示-->
		<div class="bannerCon" style="margin-top:0px;">
			<section id="slider" class="swipe" style="visibility: visible;">
				<div class="swipe-wrap">
					<div class="wrap" ><a href="#"><img src="http://img1.imgtn.bdimg.com/it/u=3469073068,3426495253&fm=11&gp=0.jpg" style="width:100%; height:114px;" alt=""></a></div>
                    <div class="wrap" ><a href="#"><img src="http://img0.ph.126.net/XjXl3KcowmXdE1pcsFVe8g==/1067353111787095545.jpgg" style="width:100%; height:114px;" alt=""></a></div>
				</div>
				<div class="bgboxgo">
					<div class="botton-box mBxCm" id="abdcd">
						<span class="on"></span>
                        <span class=""></span>
					</div>
				</div>
			</section>
		</div>


		<!--分类部分-->
		<div class="categoryContainer">
			<ul>
				<?php foreach (Category::getNavCat(['status'=> 10, 'is_show' => 1]) as $key => $value){?>
				<li>
					<a><img src="http://img0.ph.126.net/XjXl3KcowmXdE1pcsFVe8g==/1067353111787095545.jpg"  class="category_img"><span><?= $value['name'];?></span></a>
				</li>
                <?php }?>
				<li onclick="dolink('#');"  >
				<a><img style="height: 33px" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1505882222&di=39811cb3bfbb7228e78d952ab79ea1ae&imgtype=jpg&er=1&src=http%3A%2F%2Fpic.58pic.com%2F58pic%2F15%2F51%2F35%2F41n58PIC3We_1024.png" class="category_img"><span>更多</span></a>
				</li>
			</ul>
		</div>
		<!--展示-->


		<!-- 专题页 -->
<!--		<div class="advertisement"> -->
<!--			-->
<!--			<ul class="adver" style="border:none;" onclick="dolink('');">-->
<!--				<li style="width:100%;">-->
<!--					<a href="javascript:void(0);"><img  style="width:100%;" src=""></a>-->
<!--                </li>-->
<!--            </ul>-->
<!--        </div>-->

			<div class="homscrbusinCon">
				<div class="homscrbusintit"><h3>热销商品</h3></div>
                <?php
                $query = Goods::find()->where(['status' => 1]);
                $dataProvider = new ActiveDataProvider([
                    'query' => $query,
                    'pagination' => [
                        'pageSize' => 5,
                    ],
                    'sort' => [
                        'attributes' => ['id', 'name'],
                    ],
                ]);?>
                <?php Pjax::begin();?>
                <?=ListView::widget([
                    'dataProvider' => $dataProvider,
                    'itemOptions' => ['class' => 'item'],
                    'itemView' => '_item_view',
                    'pager' => ['class' => ScrollPager::className(),
                        'overflowContainer' => '#wrapper',
                        'enabledExtensions' => [
                            //ScrollPager::EXTENSION_TRIGGER,
                            ScrollPager::EXTENSION_SPINNER,
                            ScrollPager::EXTENSION_NONE_LEFT,
                            ScrollPager::EXTENSION_PAGING,
                            //ScrollPager::EXTENSION_HISTORY
                        ],
                    ],
                    'summary' => false,
                ]);?>
                <?php Pjax::end();?>
			</div>

			<!--首页结束-->
		</div>
	</div>
<script>
    // banner
	$(function(){

		var bullets = document.getElementById('abdcd').getElementsByTagName('span');
		var slider =  Swipe(document.getElementById('slider'), {
			auto: 3000,
			continuous: true,
			callback: function(pos) {
				var i = bullets.length;
				while (i--) {
					bullets[i].className = ' ';
				}
				bullets[pos].className = 'on';
			}
		});
	});
</script>

<script>
    /*购物车*/
    $(function () {
        $('.homscrbusinCon').on('click', '.addCart', function () {
            var timestamp = Date.parse(new Date());
            $.getScript($(this).attr('data-href') + '&timestamp=' +timestamp);
        });
    });
</script>


